import { createApp } from 'vue'
import './style.less'
import './utils/flexible.js'
import App from './App.vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import router from './router'
import loginHttp from "@/https/login.js"
import { ElMessage } from 'element-plus'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'

const app = createApp(App)
app.use(ElementPlus, {
    locale: zhCn,
})
app.use(router)
app.mount('#app')

// router.beforeEach((to, from, next) => {
//     console.log(to, from, next)
//     if (to.path !== '/login') {
//         loginHttp.isLogin().then(res => {
//             console.log('11111111', res.data)
//             if (res.data.msg.indexOf('true') > -1) {
//                 return next()
//             } else {
//                 ElMessage.error("账号失效，请重新登录！");
//                 return next({ path: "/login" });
//             }
//         })
//     } else {
//         loginHttp.isLogin().then(res => {
//             if (res.data.msg.indexOf('true') > -1) {
//                 return next({ path: "/home" });
//             } else {
//                 return next()
//             }
//         })
//     }
// })